home *** CD-ROM | disk | FTP | other *** search
/ Champak 64 / Volume 64 - JOGO DISK .iso / Games / the_best_every_day.swf / scripts / __Packages / MCGary.as < prev    next >
Text File  |  2008-04-10  |  2KB  |  101 lines

  1. class MCGary extends MCObstacles
  2. {
  3.    var STRING_TYPE = "Gary";
  4.    static var NUMBER_SPEED = 2;
  5.    static var NUMBER_SLOBBER = 15;
  6.    function MCGary()
  7.    {
  8.       super(this.STRING_TYPE);
  9.       this.gotoAndStop("Hide");
  10.       this.Etat = "Hide";
  11.    }
  12.    function setObstacle()
  13.    {
  14.       if(this.Etat == "Hide")
  15.       {
  16.          this.fShow();
  17.          this.onRelease = this.fHide;
  18.       }
  19.    }
  20.    function fShow()
  21.    {
  22.       this.Etat = "Appear";
  23.       this.gotoAndStop("Appear");
  24.    }
  25.    function fHide()
  26.    {
  27.       this.Etat = "Disapear";
  28.       this.gotoAndStop("Disapear");
  29.       this.deactivate();
  30.       delete this.onRelease;
  31.    }
  32.    function fUpdate()
  33.    {
  34.       if(!_global.Pack.bPaused)
  35.       {
  36.          var _loc3_ = undefined;
  37.          if(this._xscale > 0)
  38.          {
  39.             _loc3_ = 1;
  40.          }
  41.          else
  42.          {
  43.             _loc3_ = -1;
  44.          }
  45.          this._x += MCGary.NUMBER_SPEED * _loc3_;
  46.          this.addSlobber();
  47.          this.FearEdge();
  48.       }
  49.    }
  50.    function addSlobber()
  51.    {
  52.       this.nSlobber = this.nSlobber - 1;
  53.       if(this.nSlobber <= 0 && _global.C.oGame.oLevel.oObstacleManager.garyCollide())
  54.       {
  55.          var _loc4_ = this._parent.SlobberPast.getNextHighestDepth();
  56.          var _loc3_ = this._parent.SlobberPast.attachMovie("slobber","slobber" + _loc4_,_loc4_);
  57.          _loc3_._x = this._x;
  58.          _loc3_._y = this._y;
  59.          this.nSlobber = MCGary.NUMBER_SLOBBER;
  60.       }
  61.       else if(this.nSlobber <= 0)
  62.       {
  63.          this.nSlobber = MCGary.NUMBER_SLOBBER;
  64.       }
  65.    }
  66.    function FearEdge()
  67.    {
  68.       var _loc2_ = new Object({x:this.mcEdgeDetector._x,y:this.mcEdgeDetector._y});
  69.       this.localToGlobal(_loc2_);
  70.       if(!this._parent.mcFloor.hitTest(_loc2_.x,_loc2_.y,true))
  71.       {
  72.          this._xscale *= -1;
  73.       }
  74.    }
  75.    function Appear()
  76.    {
  77.       if(this.Anim._currentframe == this.Anim._totalframes)
  78.       {
  79.          this.activate();
  80.          this.nSlobber = MCGary.NUMBER_SLOBBER;
  81.          this.Etat = "Walk";
  82.          this.gotoAndStop("Walk");
  83.       }
  84.    }
  85.    function Walk()
  86.    {
  87.       this.fUpdate();
  88.    }
  89.    function Disapear()
  90.    {
  91.       if(this.Anim._currentframe == this.Anim._totalframes)
  92.       {
  93.          this.Etat = "Hide";
  94.          this.gotoAndStop("Hide");
  95.       }
  96.    }
  97.    function Hide()
  98.    {
  99.    }
  100. }
  101.